# -*- coding: utf-8 -*-
"""
Created on Fri Jan 25 13:40:11 2019

@author: caixue1
"""
import math
import pandas as pd
import numpy as np

def DeclayWeight(x_day, start_limit, end_limit):
    if x_day <= start_limit:
        y_weight = 1
    elif x_day >= end_limit:
        y_weight = 0.05
    else:
        k = 6 / (end_limit - start_limit)   #sigmod函数x=-3,y=0.95;x=3,y=0.05
        b = -3 - k*start_limit
        y_weight = 1 / (1 + math.exp(k*x_day + b))
        # y = 1/[1+exp{kx+b}])

    return y_weight  
